package com.zth.Controller;

import com.zth.entity.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 当前类里面 返回的都是json数据的时候 @ResponseBody放到类上面
 * 类上面的注解就是
 * @Controller
 * @ResponseBody
 * @Controller+@ResponseBody=@RestController
 */
@RestController  // 当前的类里面返回的都是json数据
public class UserController {





    @GetMapping("getAllUser")
    public List<User> getAll(){
      List<User> userList = new ArrayList();
      User user=new User(1,"test1","123456",new Date());
      User user1=new User(12,"test2","123456",new Date());
      User user2=new User(13,"test3","123456",new Date());
      User user3=new User(14,"test4","123456",new Date());
      userList.add(user);
      userList.add(user1);
      userList.add(user2);
      userList.add(user3);

        System.out.println(1/0);
      return userList;
    }



}
